﻿using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Net;

namespace PublicTransport.Views
{
    public partial class Map : Form
    {
        public Map()
        {
            InitializeComponent();
        }

        private void menuItem2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void menuItem1_Click(object sender, EventArgs e)
        {
            kresli();
        }

        private void kresli()
        {		
            WebRequest request = WebRequest.Create("http://maps.googleapis.com/maps/api/directions/xml?origin=48.706847,21.251212&destination=48.717388,21.250935&mode=walking&sensor=false");
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            Stream dataStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(dataStream);

            string responseFromServer = reader.ReadToEnd();
            textBox1.Text = responseFromServer;

            reader.Close();
            dataStream.Close();
            response.Close();
        }
    }
}